package org.goyo.main.domain.dao.system.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.goyo.common.exception.DBException;
import org.goyo.common.utils.Pager;
import org.goyo.main.domain.dao.BaseDAO;
import org.goyo.main.domain.dao.system.ISysResourceDao;
import org.goyo.main.domain.entity.system.SysResource;
import org.springframework.stereotype.Repository;

@Repository
public class SysResourceDaoImpl extends BaseDAO implements ISysResourceDao{

	@Override
	public SysResource findByUrl(String url) throws DBException {
		String hql = "from SysResource where url=?";
		return this.findUnique(hql, new Object[]{url});
	}

	@Override
	public List<SysResource> findByCond(Map<String, Object> cond, Pager pager) {
		StringBuffer buf = new StringBuffer("from SysResource where 1=1 order by seq");
		List<Object> params = getCondition(buf, cond);
		return this.findObjects(buf.toString(), pager, params.toArray());
	}

	public List<Object> getCondition(StringBuffer buf,Map<String, Object> cond){
		List<Object> params = new ArrayList<Object>();
		return params;
	}
}
